import { createRouter, createWebHistory } from "vue-router";
import Layout from "../layout/index.vue";

const router = createRouter({
	history: createWebHistory(),
	routes: [
		{
			path: "/",
			component: Layout,
			redirect: "/login",
			children: [
				{
					path: "bikes",
					name: "Bikes",
					component: () => import("../views/bikes/index.vue"),
					meta: { title: "单车管理" },
				},
				{
					path: "users",
					name: "Users",
					component: () => import("../views/users/index.vue"),
					meta: { title: "用户管理" },
				},
				{
					path: "orders",
					name: "Orders",
					component: () => import("../views/orders/index.vue"),
					meta: { title: "订单管理" },
				},
				{
					path: "map",
					name: "Map",
					component: () => import("../views/map/index.vue"),
					meta: { title: "监视图" },
				},
				{
					path: "count",
					name: "Count",
					component: () => import("../views/count/index.vue"),
					meta: { title: "数据统计" },
				},
			],
		},
		{
			path: "/login",
			name: "Login",
			component: () => import("../views/login/index.vue"),
			meta: { title: "登录页面" },
		},
		{
			path: "/register",
			name: "Register",
			component: () => import("../views/register/index.vue"),
			meta: { title: "注册页面" },
		},
	],
});

export default router;
